/**
 * 
 */
package org.t2.game.server.module.mail;

import java.util.ArrayList;
import java.util.List;

import org.gaming.fakecmd.annotation.PlayerGmCmd;
import org.gaming.prefab.mail.MailArgs;
import org.gaming.prefab.thing.NoticeType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.t2.design.struct.RewardThing;
import org.t2.game.server.foundation.player.PlayerContext;
import org.t2.game.server.module.mail.constant.MailTemplate;
import org.t2.game.server.module.mail.model.Mail;
import org.t2.game.server.module.mail.service.MailService;
import org.t2.game.server.module.tips.GameCause;

/**
 * @author YY
 */
@Controller
public class MailGmHandler {

	@Autowired
	private MailService mailService;
	
	@PlayerGmCmd(command = "TEST_MAIL")
	public void testMail(PlayerContext playerContext, String[] params) {
		List<RewardThing> rewardThings = new ArrayList<>();
		rewardThings.add(RewardThing.of(101001, 100000000));
		rewardThings.add(RewardThing.of(101002, 2000));
		rewardThings.add(RewardThing.of(102001, 50));
		rewardThings.add(RewardThing.of(102002, 10));
		rewardThings.add(RewardThing.of(102003, 10));
		rewardThings.add(RewardThing.of(102004, 777));
		rewardThings.add(RewardThing.of(102005, 777));
		Mail mail = mailService.newMail(playerContext.getId(), MailTemplate.SYS, MailArgs.build("这是标题"), MailArgs.build("这是内容\n\tA\n\tB\n\tC"), rewardThings, GameCause.GM);
		mailService.sendMail(mail, NoticeType.NORMAL);
	}
}
